// MainDlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

#include "CustomTabCtrl.h"
#include "Page1.h"
#include "Page2.h"
#include "Page3.h"
#include "Page4.h"
#include "Page5.h"
#include "DlgLogin.h"
#include "DlgReg.h"
#include "DlgMsg.h"

#define WM_REFRESH			(WM_USER + 100)
#define WM_TIMEDATA			(WM_USER + 101)
#define WM_RECENTDATA		(WM_USER + 102)

class CMainDlg : 
		public CResizableDialogImpl<CMainDlg>,
		public CUpdateUI<CMainDlg>,
		public CMessageFilter, public CIdleHandler
{
	typedef CResizableDialogImpl<CMainDlg> baseClass;

public:
	enum { IDD = IDD_MAINDLG };

	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnIdle();

	BEGIN_UPDATE_UI_MAP(CMainDlg)
	END_UPDATE_UI_MAP()

	BEGIN_MSG_MAP(CMainDlg)
		CHAIN_MSG_MAP(baseClass)
		NOTIFY_ID_HANDLER(IDC_TAB_CTRL, m_wndTabCtrl.OnTabChange)
		MESSAGE_HANDLER(WM_ACTIVATE, OnActive)
		MESSAGE_HANDLER(WM_SIZE, OnSize)
		MESSAGE_HANDLER(WM_REFRESH, OnRefresh)
		MESSAGE_HANDLER(WM_TIMEDATA, OnTimeData)
		MESSAGE_HANDLER(WM_RECENTDATA, OnRecentdata)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
		// MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
		COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
		COMMAND_ID_HANDLER(IDOK, OnOK)
		COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
		REFLECT_NOTIFICATIONS()
	END_MSG_MAP()	

// Handler prototypes (uncomment arguments if needed):
//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnActive(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnRefresh(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnTimeData(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnRecentdata(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);

	void CloseDialog(int nVal);
	bool SetTabCtrlName(int nVal, LPCTSTR lpszString);
	void ShowMessage(CString strText, CString strCaption = _T(""));

public:
	CMultiPaneStatusBarCtrl m_wndStatusBar;
	CCustomTabCtrl m_wndTabCtrl;
	CImageList m_listImage;
	CTabView m_view;
	CDlgLogin* m_pDlgLonin;
	CDlgMsg* m_pDlgMsg;
	CPage1* m_page1;
	CPage2* m_page2;
	CPage3* m_page3;
	CPage4* m_page4;
	CPage5* m_page5;
	HWND m_hWndClient;
	HMODULE m_hRichEdit;
};
